const BASE_URL = process.env.VUE_APP_API_URL_DATACONNECTION;
const XIN_BIAO = process.env.VUE_APP_API_URL_XINBIAO


// 数据源
const dataSource = {
  getDataSourceList: "/dataSource/getDataSourceList", // 数据源列表
  getSubSystemList: "/subsysunit/subsystemlist", // 所属系统列表
  getSourceTypeList: "/dataSource/getDataSourceTypeList", // 数据源类型列表
  getTenantList: "/tenant/pageList", // 获取子系统列表
  enableDataSource: "/dataSource/ableDataSource", //启用/禁用数据源
  getDataSourceInfo: "/dataSource/getDataSource", //获取数据源详细信息
  testConnection: "/dataSource/testConnection", //测试连接   
  deleteDataSource: "/dataSource/deleteDataSource", //删除数据源
  addDataSource: "/dataSource/addDataSource", //新增数据源
  editDataSource: "/dataSource/editDataSource", //编辑数据源

};

// 文件管理
const fileSource = {
  getTreeList: "/const/sourceDataFile/dir/list", // 文件夹列表
  // getTreeList: "/const/sourceDataFile/getDirectoryTree", // 文件夹列表
  saveFile: "/const/sourceDataFile/dir/save", //文件保存
  deleteFun: "/const/sourceDataFile/dir/delete", // 删除文件夹
};

// 业务数据资源库
const businessData = {
  getDataSourceList: "/dataSource/getDataSourceList", // 数据源列表
  getDataSourceTableList: "/localModel/getLocalModelList", // 数据源的数据表列表
  getTableDataList: "/search/pageList", // 业务数据表信息
}

// 数据汇聚
const dataAggregation = {
  getTaskList: "/taskManagement/getTaskList", // 任务列表
  deleteTask: "/taskManagement/deleteTask", // 删除任务
  executeTask: "/taskManagement/executeNow", // 立即执行
  ableTask: "/taskManagement/ableTask", // 启用/禁用任务
  operaTask: "/taskManagement/addOrUpdateTask", // 新增或编辑任务
  getTaskConfig: "/taskManagement/openTaskConfig", // 查询配置信息
  getTargetTable: "/api/v1/zbTables", // 查询目标表
  saveTaskConfig: "/taskManagement/saveTaskConfig", // 任务配置保存
  getMonitorList: "/taskLog/pageList", // 监控列表
  getMonitorResultList: "/search/pageList", // 查看任务执行数据
  getDbTableById: "/taskManagement/getTableListByDataSourceId", // 根据目标数据库 id 查询源数据列表
  getTableColumn: "/taskManagement/getSourceTableColumn", // 配置中根据源头表返回字段名称和类型
  getModelList: "/localModel/localModelListInTask", // 获取模型数据
  getFieldMapInfo: "/taskManagement/fieldMapping", // 维护字段映射

}

// 导入图谱
const importGraph = {
  startImportDataToGraph: XIN_BIAO + "/dataImport/graph", // 开始导入
}

// 物理模型
const physicalModel = {
  getModelTree: "/localModel/localModelTree", // 模型树
  getModelDetail: "/localModel/localModelDetail", // 模型详情
  updateModelInfo: "/localModel/editLocalModel", // 编辑模型
  getFieldTypes: "/localModel/filedType", // 字段类型
  getDataBases: "/localModel/targetDataBase", // 数据库
  getDataBaseTable: "/localModel/getSourceModelList", // 根据数据库查询表
  batchAddModel: "/localModel/addLocalModelList", // 批量新增模型
  postAddModel: "/localModel/addLocalModel", // 新增模型
  deleteModel: "/localModel/deleteLocalModel", // 删除表
  createTable: "/localModel/createTable", // 建表
  changeStatusTable: "/localModel/onOrOffLocalModel", // 禁用启用
  getSourceTableList: "/localModel/getLocalModelList", // 数据表
}

// 数据字典
const dataDictionary = {
  getDictList: "/dictionary/type/queryByName", // 字典列表
  addDictionary: "/dictionary/type/add", // 新增字典分类
  editDictionary: "/dictionary/type/update", // 编辑字典分类
  deleteDictionary: "/dictionary/type/delete", // 删除字典分类
  enableDictionary: "/dictionary/type/able", // 启动禁用
  getDictDataByType: "/dictionary/queryByTypeAndName", // 根据分类查询字典数据
  deleteDictData: "/dictionary/delete", // 删除字典数据
  ableDictData: "/dictionary/able", // 启用禁用字典数据
  exportDictData: "/dictionary/export", // 导出数据
  getDictParent: "/dictionary/getPossibleParents", // 获取父级
  addDictData: "/dictionary/add", // 新增字典数据
  editDictData: "/dictionary/update", // 编辑字典数据
  importDictData: "/dictionary/import", // 导入文件
}

function changeBaseUrl() {
  for (let key in dataSource) {
    dataSource[key] = BASE_URL + dataSource[key];
  }
  for (let key in businessData) {
    businessData[key] = BASE_URL + businessData[key];
  }
  for (let key in dataAggregation) {
    dataAggregation[key] = BASE_URL + dataAggregation[key];
  }
  for (let key in physicalModel) {
    physicalModel[key] = BASE_URL + physicalModel[key];
  }
  for (let key in dataDictionary) {
    dataDictionary[key] = BASE_URL + dataDictionary[key];
  }
}

changeBaseUrl();

export default {
  dataSource,
  businessData,
  importGraph,
  dataAggregation,
  physicalModel,
  dataDictionary,
  fileSource
};
